<?php
if (!isset($common)) require_once '../common.php';
require_once 'include/functions.php';

$_SESSION['i'] = $_GET['i'];
$_SESSION['j'] = $_GET['j'];

$type = getBuilding($_GET['i'], $_GET['j'], $_SESSION['idcity'][0])->getBox(); 
$_SESSION['level'] = getBuilding($_GET['i'], $_GET['j'], $_SESSION['idcity'][0])->getBoxLvl() + 1;
?>

<table border="1">
  <tr>
    <td><img style="border:none;" src=<?php if ($type == 0) echo "images/edificios/cuartel.gif";
											elseif ($type == 1) echo "images/edificios/granero.gif";
											elseif ($type == 2) echo "images/edificios/minaHierro.gif";
											elseif ($type == 3) echo "images/edificios/minaOro.gif";
											elseif ($type == 4) echo "images/edificios/aserradero.gif";   
    
    ?>
    ></td>
    <th><?php require_once 'include/edificios.php'; echo GetName($type); ?></th>
    <td>Nivel <?php echo $_SESSION['level']; ?> </td>
    <td>Recursos necesarios: <?php $coste = GetCoste($type, $_SESSION['level']); echo $coste[1]." grano";  echo ", ".$coste[2]." hierro"; echo ", ".$coste[3]." oro"; echo ", ".$coste[4]." madera"; ?></td>
    <td>Tiempo: <?php echo tiempo_segundos($coste[0]); ?>
  </tr>
</table>

<input type="button" value="Mejorar" onclick="upgrade(<?php echo $type; ?>)">
<input type="button" value="Salir" onclick="closeModalBox()">
